import 'package:flutter/material.dart';
import 'package:date_format/date_format.dart';
class DatePickerPage extends StatefulWidget {
  DatePickerPage({Key key}) : super(key: key);

  _DatePickerPageState createState() => _DatePickerPageState();
}

class _DatePickerPageState extends State<DatePickerPage> {
  var now = new DateTime.now(); 
  void initState(){
    super.initState();
    print(now);                        //当前日期 
    print(now.millisecondsSinceEpoch); //转时间戳
    print(DateTime.fromMillisecondsSinceEpoch(now.millisecondsSinceEpoch)); //时间戳转日期
    print(formatDate(now, [yyyy, '年', mm, '月', dd , '日']));
  }
  @override
  Widget build(BuildContext context) {
    return Container(
       child: Scaffold(
          appBar: AppBar(
          title: Text('DatePickerPage'),
        ),
       ),
    );
  }
}